package com.smedi.ismedi.cronjob.api.infrastructure.enumerate;

public enum CronParamEnum {
    EVERY_SECONDS(0, "每秒重复执行"),

    EVERY_MINUTES(1, "每分钟重复执行"),

    EVERY_HOURS(2, "每小时重复执行"),

    EVERY_DAY(3, "每天重复执行"),

    EVERY_MONTH(4, "每月重复执行"),

    EVERY_WEEK(5, "每周重复执行"),

    EVERY_YEAR(6, "每年重复执行"),

    LAST_DAY(7, "每月最后一天重复执行"),

    LAST_WEEK(8, "每月最后一周重复执行");

    private String name;

    private int value;

    CronParamEnum(int value, String name) {
        this.name = name;
        this.value = value;
    }

    public static String getName(int value) {
        for (CronParamEnum c : CronParamEnum.values()) {
            if (c.getValue() == value) {
                return c.name;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

}
